//package JavaSE_core.IO;
//
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.io.ObjectInputStream;
//import java.io.ObjectOutputStream;
//
//public class Demo15 {
//
//	public static void main(String[] args) throws Exception, IOException {
////		write();
//		read();
//	}
//
//	private static void read() throws IOException, FileNotFoundException, ClassNotFoundException {
//		ObjectInputStream ois=new ObjectInputStream(new FileInputStream("c:/d.data"));//创建对象输入流，用于对象反序列化
//		Person p=(Person) ois.readObject();//反序列化指定对象，读取顺序必须和写入顺序一致
//		Student s=(Student) ois.readObject();
//		demo.User u=(demo.User) ois.readObject();
//		ois.close();
//		System.out.println(p.getName());
//		System.out.println(p.getAge());
//		System.out.println(s);
//		System.out.println(u);
//	}
//
//	private static void write() throws IOException, FileNotFoundException {
//		Person p=new Person("吴京",33);
//		Student s=new Student("谢楠", 29, "JAVA6");
//		demo.User u=new demo.User ("admin", "123");
//		ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("c:/d.data"));//创建对象输出流，用于对象序列化
//		oos.writeObject(p);//序列化指定对象，需要目标对象类实现Serializable接口，否则产生NotSerializableException异常
//		oos.writeObject(s);
//		oos.writeObject(u);
//		oos.close();
//	}
//
//}
